﻿FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 7000

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Hicap.QRCodeWarehouse.WebApi/Hicap.QRCodeWarehouse.WebApi.csproj Hicap.QRCodeWarehouse.WebApi/
COPY Hicap.QRCodeWarehouse.Application/Hicap.QRCodeWarehouse.Application.csproj Hicap.QRCodeWarehouse.Application/
COPY Hicap.QRCodeWarehouse.Core/Hicap.QRCodeWarehouse.Core.csproj Hicap.QRCodeWarehouse.Core/
RUN dotnet restore Hicap.QRCodeWarehouse.WebApi/Hicap.QRCodeWarehouse.WebApi.csproj
COPY . .
WORKDIR /src/Hicap.QRCodeWarehouse.WebApi
RUN dotnet build Hicap.QRCodeWarehouse.WebApi.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish Hicap.QRCodeWarehouse.WebApi.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Hicap.QRCodeWarehouse.WebApi.dll"]
